<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title>验货单列表 - WMS仓库管理系统</title>
</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">

<div class="layui-body" style="padding:15px;top: 0px;">
    <style type="text/css">
        .record-box h2 {
            font-weight: bold;
            font-size: 18px;
            margin-bottom: 40px;
        }

        .record-input input {
            width: 400px;
            height: 22px;
            line-height: 22px;
            font-size: 16px;
            padding: 14px 9px;
            border: 1px solid #787878;
        }
    </style>
    <!-- start sp-wrapper -->
    <link rel="stylesheet" href="/sb/stock.css"/>
    <div class="sp-wrapper">
        <h2 class="sp-title">
            <a class="active" href="/checkout/checkout_list">全部</a>
            <a href="/checkout/checkout_list?status=0">未入库</a>
            <a href="/checkout/checkout_list?status=1">已入库</a>
        </h2>
        <div class="sp-tool">
            <span class="fl">
                <form action="/checkout/checkout_list" method="get">
                <b><input type="text" id="billNo" name="billNo" autocomplete="off" th:value="${billNo}"
                          placeholder="输入单据编号查询"></b>
                <b><input type="submit" class="button" value="查询"></b>
                    <b>总共：&nbsp;[[${totalSize}]]&nbsp;条记录</b>
                </form>
            </span>

            <span class="fr">
<!--                <a href="/purchase/add" class="add">新增采购单</a>-->
                <!--                <i id="saomaoruku">扫码入库</i>-->
            </span>
        </div>
        <div class="sp-table">
            <table>
                <thead>
                <tr>
                    <th>ID</th>
                    <th>验货单号</th>
                    <th>类型</th>
                    <th>验货人</th>
                    <th>来源单据编号</th>
                    <th>是否有QC报告</th>
                    <th>验货总数量</th>
                    <th>已入库</th>
                    <th>验货时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="item:${list}">
                    <td th:text="${item.id}">2019-4-11</td>
                    <td th:text="${item.number}">CG190411100335401</td>
                    <td th:text="${item.transTypeName}">华衣</td>
                    <td th:text="${item.checkoutUserName}">华衣</td>
                    <td th:text="${item.invoiceNo}">500</td>
                    <td>
                        <i th:if="${item.hasQcReport == 1}">有QC报告</i>
                        <i th:if="${item.hasQcReport == 0}">没有QC报告</i>
                    </td>
                    <td th:text="${item.quantity}"></td>
                    <td th:text="${item.inQuantity}"></td>

                    <td th:text="${#dates.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}">2019-4-11</td>
                    <td>
                        <input type="hidden" class="id" th:value="${item.id}">

                        <i class="print" th:attr="data-id=${item.id}">打印</i>
                        <a class="stockIn" th:if="${item.stockInStatus == 0}"  th:href="${'/checkout/stock_in?id='+item.id}" target="_blank">入库</a>
                        <a class="stockIn" th:href="${'/checkout/stock_in_logs?id='+item.id}" target="_blank">入库记录</a>
                    </td>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="pages">
            <paging:pager th:value="${pageIndex}" th:rows="${totalSize}" th:size="${pageSize}"/>
        </div>
    </div>


    <script type="text/javascript" src="/sb/jquery.min.js"></script>
    <script type="text/javascript" src="/sb/Tips.min.js"></script>

    <style type="text/css">
        .check-box {
            position: relative;
            width: 900px;
            padding: 0 5px;
            font-size: 13px;
            color: #787878;
        }

        .check-info {
            line-height: 40px;
            overflow: hidden;
        }

        .check-info span {
            float: left;
            width: 18%;
            text-align: center;
        }

        .check-info span:nth-child(1) {
            width: 30%;
            text-align: left;
        }

        .check-info span:nth-child(5) {
            width: 16%;
            text-align: right;
        }

        .check-table {
            margin: 10px 0;
            max-height: 250px;
            overflow-y: auto;
        }

        .check-table table {
            width: 100%;
        }

        .check-table th, .check-table td {
            padding: 10px 0;
            font-size: 13px;
            text-align: center;
            border: 1px solid #787878;
        }

        .check-table th {
            padding: 5px 0;
        }
    </style>
    <script type="text/template" id="tpl-1">
        <div class="check-box">
            <div class="check-info">
                <span>单据编号：<i id="r-number">CG190411100335401</i></span>
                <span>单据日期：<i id="r-time">2019-04-11</i></span>
                <span>采购数量：<i id="r-count">2000</i></span>
                <span>制单人：<i id="r-name">张三</i></span>
                <span>供应商：<i id="r-trader">华衣</i></span>
            </div>
            <div class="check-table">
                <table>
                    <thead>
                    <tr>
                        <th>SKU</th>
                        <th>商品</th>
                        <th>采购数量</th>
                        <th>合格数量</th>
                        <th>异常数量</th>
                    </tr>
                    </thead>
                    <tbody id="r-table">

                    </tbody>
                </table>
            </div>
        </div>
    </script>
    <script type="text/javascript">
        layui.use(['laydate', 'layer'], function () {
            var laydate = layui.laydate;
            var layer = layui.layer;
            //执行一个laydate实例
            $(".print").click(function () {
                var id = $(this).attr("data-id");
                console.log(id);
                //iframe层
                layer.open({
                    type: 2,
                    title: '打印验货单',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['940px', '90%'],
                    content: '/checkout/print_detail?id=' + id //iframe的url
                });
            });
        });
    </script>
    <!-- end sp-wrapper -->
    <!-- 不同部分 end -->
</div>
</div>
</body>
</html>
